#pragma once


#include "math/Vector.hpp"
#include <random>

class RandomFloat
{
public:
    RandomFloat(float min, float max): _min(min), _max(max), _uniform_real(_min, _max)
    {
        std::random_device device;
        _mt19937.seed(device());
    }

    float next()
    {
        return _uniform_real(_mt19937);
    }

private:
    float _min;
    float _max;
    std::mt19937 _mt19937;
    std::uniform_real_distribution<float> _uniform_real;
};

class RandomUnitVector
{
public:
    RandomUnitVector() : _rand(-1.0f, 1.0f){}

    Vector next()
    {
        Vector v;
        do
        {
            v = Vector(_rand.next(), _rand.next(), _rand.next());
        } while (v.length() > 1.0f);
        return v.getNormalized();
    }

private:
    RandomFloat _rand;
};